
  -----------------------------
  -- zExperinceTest
  -- zork - 2014
  -----------------------------

  -----------------------------
  -- VARIABLES
  -----------------------------

  local cs = CHAT_SYSTEM
  local em = GetEventManager()
  local addon = ZO_Object:Subclass()

  -----------------------------
  -- FUNCTIONS
  -----------------------------
  
  local function p(str)
    cs:AddMessage(str)
  end

  --new func
  function addon:New()
    self.addonName = "zExperienceTest"
    self:Initialize()
  end

  --init func
  function addon:Initialize()
    --event registering
    em:RegisterForEvent(self.addonName.."_OnUnitCreated",             EVENT_UNIT_CREATED,               function(...) self:OnUnitCreated(...) end)
    em:RegisterForEvent(self.addonName.."_OnExperienceGain",          EVENT_EXPERIENCE_GAIN,            function(...) self:OnExperienceGain(...) end)
    em:RegisterForEvent(self.addonName.."_OnExperienceGainDiscovery", EVENT_EXPERIENCE_GAIN_DISCOVERY,  function(...) self:OnExperienceGainDiscovery(...) end)
    em:RegisterForEvent(self.addonName.."_OnExperienceUpdate",        EVENT_EXPERIENCE_UPDATE,          function(...) self:OnExperienceUpdate(...) end)
    em:RegisterForEvent(self.addonName.."_OnPlayerActivated",         EVENT_PLAYER_ACTIVATED,           function(...) self:OnPlayerActivated(...) end)
  end
  
  --OnPlayerActivated event trigger func
  function addon:PrintExperience()
    local curExp, maxExp, perExp, lvl = GetUnitXP("player"), GetUnitXPMax("player"), GetUnitXP("player")/GetUnitXPMax("player")*100, GetUnitLevel("player")
    p("Level: "..lvl..", Experience: "..curExp.."/"..maxExp.." ("..perExp.."%)")
  end

  --OnPlayerActivated event trigger func
  function addon:OnPlayerActivated(...)
    p("OnPlayerActivated")
    self:PrintExperience()
  end
  
  --OnUnitCreated event trigger func
  function addon:OnUnitCreated(...)
    local eventCode, unitTag = ...
    if unitTag ~= "player" then return end
    p("OnUnitCreated")
    self:PrintExperience()
  end
  
  --OnExperienceGain event trigger func
  function addon:OnExperienceGain(...)
    local eventCode, value, reason = ...
    p("OnExperienceGain")
    p(value.." exp gained")
    self:PrintExperience()
  end
  
  --OnExperienceGain event trigger func
  function addon:OnExperienceGainDiscovery(...)
    local eventCode, areaName, value = ...
    p("OnExperienceGainDiscovery")
    p(value.." exp gained for discovering "..areaName)
    self:PrintExperience()
  end
  
  --OnExperienceGain event trigger func
  function addon:OnExperienceUpdate(...)
    local eventCode, unitTag, currentExp, maxExp, reason = ...
    if unitTag ~= "player" then return end
    p("OnExperienceUpdate")
    self:PrintExperience()
  end

  -----------------------------
  -- CALL
  -----------------------------

  addon:New()